let log_utils = require('../utils/log_util');

function * resolve_log(next){

	let startDate = new Date();
	//定义间隔时间
	let ms;
	try{

		yield next;

		ms = new Date() - startDate;
		//记录响应日志
		log_utils.logResponse(this,ms);

	}catch(err){

		ms = new Date() - startDate;

		log_utils.logError(this,err,ms);
	}

}

module.exports = resolve_log;